/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.account.Key.DistributionListBy;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.account.DistributionList;
/*    */ import com.zimbra.cs.account.Group;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.ShareInfo.NotificationSender;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.cs.mailbox.OperationContext;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import com.zimbra.soap.admin.message.AddDistributionListMemberResponse;
/*    */ import java.util.Arrays;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class AddDistributionListMember
/*    */   extends ReloadMemberPostProxyHandler
/*    */ {
/*    */   public boolean defendsAgainstDelegateAdminAccountHarvesting()
/*    */   {
/* 46 */     return true;
/*    */   }
/*    */   
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 52 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 53 */     OperationContext octxt = getOperationContext(zsc, context);
/* 54 */     Provisioning prov = Provisioning.getInstance();
/*    */     
/* 56 */     Group group = getGroupFromContext(context);
/* 57 */     String id = request.getAttribute("id");
/* 58 */     defendAgainstGroupHarvesting(group, Key.DistributionListBy.id, id, zsc, Rights.Admin.R_addGroupMember, Rights.Admin.R_addDistributionListMember);
/*    */     
/*    */ 
/* 61 */     List<String> memberList = getMemberList(request, context);
/* 62 */     if (memberList.isEmpty()) {
/* 63 */       throw ServiceException.INVALID_REQUEST("members to add not specified", null);
/*    */     }
/*    */     
/* 66 */     String[] members = (String[])memberList.toArray(new String[0]);
/* 67 */     prov.addGroupMembers(group, members);
/* 68 */     ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "AddDistributionListMember", "name", group.getName(), "members", Arrays.deepToString(members) }));
/*    */     
/*    */ 
/*    */ 
/*    */ 
/* 73 */     if (!group.isDynamic())
/*    */     {
/*    */ 
/* 76 */       boolean sendShareInfoMsg = group.getBooleanAttr("zimbraDistributionListSendShareMessageToNewMembers", true);
/*    */       
/* 78 */       if (sendShareInfoMsg) {
/* 79 */         ShareInfo.NotificationSender.sendShareInfoMessage(octxt, (DistributionList)group, members);
/*    */       }
/*    */     }
/*    */     
/* 83 */     return zsc.jaxbToElement(new AddDistributionListMemberResponse());
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 88 */     relatedRights.add(Rights.Admin.R_addDistributionListMember);
/* 89 */     relatedRights.add(Rights.Admin.R_addGroupMember);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/AddDistributionListMember.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */